import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
export default new Vuex.Store({
  state: {
    userName: ''
  },
  mutations: {
    setUserName (state, userName) {
      state.userName = userName
      localStorage.setItem('userName', userName)
    }
  },
  getters: {
    getUserName (state) {
      return localStorage.getItem('userName')
    }
  }
})
